package com.yanqu.road.server.cmd.activity.signindraw;

import com.yanqu.road.entity.activity.signindraw.SignInDrawConfig;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.SignInDrawProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.signindraw.SignInDrawActivityMgr;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_SIGN_IN_DRAW_NOTICE, desc = "获取抽奖公告")
public class SignInDrawNoticeListCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

        // 没有活动
        SignInDrawConfig config = SignInDrawActivityMgr.getConfig();
        if (config == null || !ActivityMgr.activityInShowTime(config.getActivityInfo())) {
            ret = GameErrorCode.E_ACTIVITY_OVER_TIME;
            return;
        }

        SignInDrawProto.CrossSignInDrawNoticeReqMsg.Builder reqMsg = SignInDrawProto.CrossSignInDrawNoticeReqMsg.newBuilder();
        reqMsg.setActivityId(config.getActivityInfo().getActivityId());

        player.sendPacket(Protocol.C_SIGN_IN_DRAW_NOTICE, reqMsg);

    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
